#include <Eigen/Eigen>
#include <iostream>

using namespace Eigen;
using namespace std;

int main()
{
    MatrixXf PB(3,1);
    MatrixXf R(3,3);
    MatrixXf PA(3,1);
    MatrixXf C(3,1);

    PB<<1,2,0;
    R<<-0.866,-0.5,0,0.5,0.866,0,0,0,1;
    PA=R.transpose()*PB;
    cout<<"----------------------------------------------第1题-----------------------------------------------------"<<endl;
    cout<<"PB=\n"<<PB<<endl<<endl;
    cout<<"R=\n"<<R<<endl<<endl;
    cout<<"PA=\n"<<PA<<endl<<endl;
    C<<2,-3,1;
    PA=PB-C;
    cout<<"----------------------------------------------第2题-----------------------------------------------------"<<endl;
    //cout<<"PB=\n"<<PB<<endl<<endl;
    //cout<<"R=\n"<<R<<endl<<endl;
    cout<<"PA=\n"<<PA<<endl<<endl;
    R<<0.707,0,0.707,0,1,0,-0.707,0,0.707;
    PA=R*PB;
    cout<<"----------------------------------------------第3题-----------------------------------------------------"<<endl;
    //cout<<"PB=\n"<<PB<<endl<<endl;
    cout<<"R=\n"<<R<<endl<<endl;
    cout<<"PA=\n"<<PA<<endl<<endl;

    R<<1,0,0,0,0.866,-0.5,0,0.5,0.866;
    PA=R.transpose()*PB;
    cout<<"----------------------------------------------第4题-----------------------------------------------------"<<endl;
    //cout<<"PB=\n"<<PB<<endl<<endl;
    cout<<"R=\n"<<R<<endl<<endl;
    cout<<"PA=\n"<<PA<<endl<<endl;

}